package com.zhnc.dangjianpingtaiapp.gui.base;

import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.LinearLayout;

import com.jaeger.library.StatusBarUtil;
import com.wangdh.utilslibrary.utils.TDevice;
import com.zhnc.dangjianpingtaiapp.R;

public class BaseActivity extends AppCompatActivity {
    protected LinearLayout content;
    protected LinearLayout mask;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);

        StatusBarUtil.setColor(this, getResources().getColor(R.color.title_color));
        super.setContentView(R.layout.activity_base);
        //顶起系统的title 高度
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            View ztl = findViewById(R.id.ztl);
            ViewGroup.LayoutParams layoutParams = ztl.getLayoutParams();
            layoutParams.height = TDevice.getStatusBarHeight(this);
            ztl.setLayoutParams(layoutParams);
        }
        content = findViewById(R.id.content);
        mask = findViewById(R.id.content);
    }

    @Override
    public void setContentView(int layoutResID) {
        View inflate = View.inflate(this, layoutResID, null);
        try {
            content.removeAllViews();
        } catch (Exception e) {
        }
        content.addView(inflate);
//        super.setContentView(inflate);
    }


}
